package com.wfm.files.bio;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class FileProcessor {
    public static void main(String[] args) {
        String inputFile = "input.txt"; // 文件 A 的路径
        String outputFile = "output.txt"; // 文件 B 的路径

        try (BufferedReader reader = new BufferedReader(new FileReader(inputFile));
             BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile))) {
            String line;
            while ((line = reader.readLine()) != null) {
                // 处理每一行：将字符用逗号分隔
                StringBuilder processedLine = new StringBuilder();
                for (int i = 0; i < line.length(); i++) {
                    processedLine.append(line.charAt(i));
                    if (i < line.length() - 1) {
                        processedLine.append(",");
                    }
                }
                // 将处理后的行写入文件 B
                writer.write(processedLine.toString());
                writer.newLine(); // 写入换行符
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}